let regular = {
    //*****************校验手机号******************
    phoneNumCheck: function(str) {
        let phoneReg = /^[1][0-9]{10}$/;
        return phoneReg.test(str);
    },
    //*****************校验密码******************
    pwdCheck: function(str) {
        let pwdReg = /^[\da-zA-Z^\da-zA-Z]{6,18}$/;
        return pwdReg.test(str);
    },

    pwdCheckForLogin: function(str) {
        let pwdReg = /^[\da-zA-Z^\da-zA-Z]{3,10}$/;
        return pwdReg.test(str);
    },

    //*****************校验密码(8-16 数字字母特殊符号的任意三种组合)******************
    pwdPlexCheck: function(str) {
        let pwdReg = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,16}$/;
        return pwdReg.test(str);
    }, //
    //*****************校验手机动态码************
    codeCheck: function(str) {
        var codeReg = /^\d{6}$/;
        return codeReg.test(str);
    },
    //*****************校验邮箱******************
    emailCheck: function(str) {
        let reg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
        return reg.test(str);
    },
    //*****************敏感字符校验***************
    sensitiveCheck: function(str) {
        let sensitiveReg = /^(\d{4})(\d*)(\d{4})$/;
        return (str.toString()).replace(sensitiveReg, function(a, b, c, d) {
            return b + c.replace(/\d/g, "*") + d;
        });
    },
    //*****************校验身份证号码*************
    idCardCheck: function(arrIdCard) {
        let tag = false;
        let sigma = 0;
        let a = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
        let w = new Array("1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2");
        for (let i = 0; i < 17; i++) {
            let ai = parseInt(arrIdCard.substring(i, i + 1));
            let wi = a[i];
            sigma += ai * wi;
        }
        let number = sigma % 11;
        let check_number = w[number];
        if (arrIdCard.substring(17) != check_number) {
            tag = false;
        } else {
            tag = true;
        }
        return tag;
    },

    //*****************价钱的过滤*************
    pare: function(data) {
        if (data) {
            data = data.toString();
            if (data.indexOf('.') != -1) {
                if (data.split('.')[1] == '00' || data.split('.')[1] == '0') {
                    return data.split('.')[0]
                } else {
                    return data
                }
            } else {
                return data
            }
        } else {
            return data
        }
    },
    //检验商品信息的长宽高
    length: function(str) {
        let length = /^[0-9]*$/;
        return length.test(str);
    },
    //验证姓名
    verifyName: function(str) {
        var name = /^[\u4E00-\u9FA5A-Za-z]{2,5}$/;
        return name.test(str);
    },
    //匹配中文
    verChinese: function(str) {
        var chinese = /^[\u4e00-\u9fa5]{2,22}$/;
        return chinese.test(str);
    },
    //账号校验
    verAccount: function(str) {
        var account = /^[0-9]+$/;
        return account.test(str);
    },
    //过滤非法字符的校验
    filterChar: function(str) {
        var char = /[@#\$%\^&\*]+/;
        return char.test(str);
    },
    //小数点保留2位
    commissionVal: function(str) {
        var char = /^[0-9]{1,2}\.?[0-9]{0,2}$/;
        return char.test(str)
    },
    //过滤佣金百分比
    Percentage: function(str) {
        var char = /^[0-9]\d{0,1}$/;
        return char.test(str)
    },
    //验证座机手机号
    phoneNUmber: function(str) {
        var char = /^\d{3}-\d{8}|\d{4}-\d{7}$/;
        return char.test(str)
    },

    code: function(str) {
        var char = /^[a-zA-Z\d]+$/;
        return char.test(str)
    },
    // 重量检验
    weight: function(str) {
        var char = /^[0-9]{1,3}\.?[0-9]{0,2}$/;
        return char.test(str)
    }

}


export default regular;